﻿using Microsoft.Win32;

namespace AOTToolConsoleApp.Tools
{
    internal class WPSRemoveNetdiskTool : ITool
    {
        public void Excute(string[] args)
        {
            var registryView = Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32;
            using RegistryKey currentUserRegistryKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, registryView);

            using RegistryKey desktopNameSpaceKey = currentUserRegistryKey.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace");
            if (desktopNameSpaceKey != null)
            {
                desktopNameSpaceKey.DeleteSubKeyTree("{7AE6DE87-C956-4B40-9C89-3D166C9841D3}", false);
            }

            using RegistryKey myComputerNameSpaceKey = currentUserRegistryKey.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace");
            if (myComputerNameSpaceKey != null)
            {
                myComputerNameSpaceKey.DeleteSubKeyTree("{5FCD4425-CA3A-48F4-A57C-B8A75C32ACB1}", false);
            }
        }
    }
}


